package com.lexiang.base.controller;

import entity.Result;
import entity.StatusCode;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @BelongsProject:lx_parent
 * @BelongsPackage:com.lexiang.base.controller
 * @Author:linchong
 * @CreateTime:2019-04-02 19:55
 * @Description: 统一异常处理
 */
@Controller
public class LabelExceptionHandler {

    @ExceptionHandler(value = Exception.class)
    @ResponseBody
    public Result error(Exception e){
        e.printStackTrace();;
        return new Result(false, StatusCode.ERROR,
                e.getMessage());
    }
}
